##############################################################
#Figure D1: Distribution of Risk Aversion in HRS
##############################################################

data <- read.dta13("U:/temp/hrs_toplot.dta")
data$risk <- as.factor(data$risk)
out <- as.data.frame(prop.table(table(data$risk)))
ggplot(out, aes(as.factor(Var1), Freq)) + geom_bar(stat ="identity", fill="grey60") + 
  theme_classic() + ylab("Percent") + xlab ("Risk Aversion") + 
  scale_x_discrete(labels=c("Risk Tolerant", " ", " ", " ", " ", "Risk Averse")) + 
  theme(panel.background = element_blank(),
        axis.line.x = element_blank(),
        axis.ticks.x = element_blank()) + 
  scale_y_continuous(breaks = c(0, 0.1, 0.2, 0.3, 0.4, 0.5), limits=c(0,0.5), expand=c(0,0))
ggsave("U:/export/figd1.pdf")  